package com.evan.review.stickytop;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.evan.review.R;
import java.util.ArrayList;
import java.util.List;

/**
 * 吸顶效果学习示例
 * 演示简单的AppBarLayout实现吸顶效果
 */
public class StickyTopActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private StickyContentAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sticky_top);
        
        initViews();
        setupRecyclerView();
    }

    private void initViews() {
        recyclerView = findViewById(R.id.recycler_view);
    }

    private void setupRecyclerView() {
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        
        // 创建测试数据
        List<String> data = new ArrayList<>();
        for (int i = 1; i <= 50; i++) {
            data.add("列表项目 " + i + "\n这是一个演示吸顶效果的列表项目，当向上滑动时，顶部的圆角区域会吸附在状态栏下方。");
        }
        
        adapter = new StickyContentAdapter(data);
        recyclerView.setAdapter(adapter);
    }
} 